﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Pout_Porri.Objects.Interface;
using Pout_Porri.Utils;


namespace Pout_Porri.Objects
{
    class Pow : Enemy
    {
        private Animation powStand, powPressed;

        private int count = 0;
        
        public Pow(Texture2D image, Vector2 position, Vector2 velocity)
            : base(image, position, velocity)
        {
            this.texture = image;
        }

        public override void configAnimations()
        {
            powStand = new Animation("powstand", new Vector2(84, 84), 250, 8, 4, 1, Axis.X);
            this.addAnimation(powStand);

            powPressed = new Animation("powpressed", new Vector2(84, 84), 250, 9, 4, 1, Axis.X);
            this.addAnimation(powPressed);

            this.spriteTexture = new Texture2D(Game1.graphics.GraphicsDevice, 84, 84);
            /*
            this.spriteTexture = Utils.Util.CreatePartImage(AnimationRect(flowerStand), this.texture);
            Utils.Util.SaveSprite("Content\\Images\\Mario\\flowerstand.png", this.spriteTexture);
             */

            this.setCurrentAnimation("powstand");
            currentState = EnemyStates.stand;
        }

        public override void update(GameTime gameTime)
        {

            if (currentState == EnemyStates.stand)
            {
                this.setCurrentAnimation("powstand");
                this.currentAnimationRect = this.AnimationRect(powStand);

            }

            if (currentState == EnemyStates.dying)
            {
                this.setCurrentAnimation("powpressed");
                this.currentAnimationRect = this.AnimationRect(powPressed);
                
                if (count <= 150)
                    count++;

                if (count == 150)
                {
                    currentState = EnemyStates.stand;
                    count = 0;
                }
            }

            base.update(gameTime);
        }



    }
}
